Skip to content

DPL: let dpl-tune infer a binding TF rate limit without in-flight metrics - #16269

Merged
ktf merged 2 commits into
AliceO2Group:devfrom
ktf:pr16269
Dec 3, 2026
Merged

ktf merged 2 commits into
AliceO2Group:devfrom
ktf:pr16269

Conversation

@ktf

@ktf ktf commented Dec 3, 2026

Copy link
Copy Markdown
Member

On an async reconstruction (CTF reader, GPU TPC, ITS with 4 lanes,
matching, vertexing) run with --timeframes-rate-limit 2 on an O2 without
the rate limiting metrics, dpl-tune proposed nothing, although the 16
cores were 26% used and no device was busy more than 36% of the time:

  • the CTF reader counted as 99% busy. It waits for the TF rate limit
    inside its callback (RateLimiter), so its wall time is not work. A TF
    source whose wall time is more than twice its CPU time now gets its
    CPU time as busy time. The AOD reader keeps its wall time: it is
    throttled by resource offers before its callback, which is reading.
  • the driver's total-timeframes-in-flight (read - consumed) is negative
    when no AOD reader counts the TFs read, and was taken as 0 TFs in
    flight. It is now unknown.
  • the TF limit was read only from the driver stage, and was never
    considered without the in-flight metrics. It is now read from any
    stage. When the TFs in flight are unknown, the limit is inferred to
    bind if the busy times per TF along the critical path of the
    topology's data flow, a lower bound of the latency, reach half the
    limit times the observed s/TF while the devices are mostly idle. The
    limit is then raised within the budget, the memory per TF being the
    sampled shm, the bytes sent per TF, or else the shm segment over the
    limit (an upper bound); the segment is scaled with the limit.
    tuning.md says that the limit is inferred, and which memory per TF is
    used, and names the next limits.

Two more fixes were needed on the way: the driver keeps the last 1024
samples of a metric, so total-timeframes-consumed may start above 1;
the steady-state window now starts at the first completion actually
seen, not at the first sample (which counted TFs completed before the
window). And the measured memory now counts every lane of a pipelined
device, not one.

Devices within 1.3x of the slowest are now pipelined together when that
gains 1.3x, instead of not at all.

On that reconstruction, 13.6 s/TF: 2 GB/core on 16 cores leaves the
limit at 2 (45 GiB measured, above the budget); 4 GB/core raises it to
3 (9.1 s/TF predicted); 128 GB on 32 cores to 10 with 2 lanes of the
ITS-TPC and TOF matchers (2.7 s/TF). The ITS clusterer and tracker get
no lanes. On the earlier analysis and full system test probes the
proposals are unchanged, except where total-timeframes-consumed did not
start at 0 or 1: the window is shorter and the s/TF higher (e.g. 0.257
to 0.584 s/TF on a 139 TF run whose counter started at 78), and on one
Grid train --aod-memory-rate-limit drops from 1246 to 831 MB.

test_dpl_tune.py runs the tuner on a synthetic reconstruction with
python3 -m unittest.

ktf added 2 commits December 3, 2026 10:27
With "DPL: dump the rate limiting and drop metrics" performanceMetrics.json
has the computations of every device, the bytes they send and their
dropped computations and messages. dpl-tune now uses them for
reconstruction workflows:

- the TFs in flight are the computations of the TF source (the reader or
  proxy) minus the TFs consumed by the sink;
- --timeframes-rate-limit is raised when that limit binds while the
  devices are mostly idle, and lowered when the probe exceeds the memory
  budget and fewer TFs in flight fit it;
- --shm-segment-size is sized from the TFs in flight and the shared
  memory per TF (the sampled segment, or the bytes sent per TF);
- tuning.md gets a "Back-pressure and drops" section: dropped
  computations and messages, missing resource offers (debug builds) and
  whether the TF limit binds.

Without these metrics (an older O2) the tuning is unchanged: on the
probes of the two analysis reproducers and of the full system test
tuning.md is byte-identical. On the full system test with the new
metrics nothing changes either: all 8 TFs are in flight at once and the
run is bound by the first TF's latency; with a TF limit of 4 the limit
is reported as binding.
…rics

On an async reconstruction (CTF reader, GPU TPC, ITS with 4 lanes,
matching, vertexing) run with --timeframes-rate-limit 2 on an O2 without
the rate limiting metrics, dpl-tune proposed nothing, although the 16
cores were 26% used and no device was busy more than 36% of the time:

- the CTF reader counted as 99% busy. It waits for the TF rate limit
  inside its callback (RateLimiter), so its wall time is not work. A TF
  source whose wall time is more than twice its CPU time now gets its
  CPU time as busy time. The AOD reader keeps its wall time: it is
  throttled by resource offers before its callback, which is reading.
- the driver's total-timeframes-in-flight (read - consumed) is negative
  when no AOD reader counts the TFs read, and was taken as 0 TFs in
  flight. It is now unknown.
- the TF limit was read only from the driver stage, and was never
  considered without the in-flight metrics. It is now read from any
  stage. When the TFs in flight are unknown, the limit is inferred to
  bind if the busy times per TF along the critical path of the
  topology's data flow, a lower bound of the latency, reach half the
  limit times the observed s/TF while the devices are mostly idle. The
  limit is then raised within the budget, the memory per TF being the
  sampled shm, the bytes sent per TF, or else the shm segment over the
  limit (an upper bound); the segment is scaled with the limit.
  tuning.md says that the limit is inferred, and which memory per TF is
  used, and names the next limits.

Two more fixes were needed on the way: the driver keeps the last 1024
samples of a metric, so total-timeframes-consumed may start above 1;
the steady-state window now starts at the first completion actually
seen, not at the first sample (which counted TFs completed before the
window). And the measured memory now counts every lane of a pipelined
device, not one.

Devices within 1.3x of the slowest are now pipelined together when that
gains 1.3x, instead of not at all.

On that reconstruction, 13.6 s/TF: 2 GB/core on 16 cores leaves the
limit at 2 (45 GiB measured, above the budget); 4 GB/core raises it to
3 (9.1 s/TF predicted); 128 GB on 32 cores to 10 with 2 lanes of the
ITS-TPC and TOF matchers (2.7 s/TF). The ITS clusterer and tracker get
no lanes. On the earlier analysis and full system test probes the
proposals are unchanged, except where total-timeframes-consumed did not
start at 0 or 1: the window is shorter and the s/TF higher (e.g. 0.257
to 0.584 s/TF on a 139 TF run whose counter started at 78), and on one
Grid train --aod-memory-rate-limit drops from 1246 to 831 MB.

test_dpl_tune.py runs the tuner on a synthetic reconstruction with
python3 -m unittest.
@ktf
ktf requested a review from a team as a code owner December 3, 2026 09:29
@ktf
ktf merged commit 03cef4a into AliceO2Group:dev Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant